package leecode

import (
	"strings"
)

func capitalizeTitle(title string) string {
	title = strings.ToLower(title) //先将全部字符转化为小写
	wordArr := strings.Split(title, " ")
	var result string
	for i := 0; i < len(wordArr); i++ {
		if len(wordArr[i]) <= 2 {
			continue
		}
		temp := wordArr[i]
		wordArr[i] = strings.ToUpper(temp[:1]) + temp[1:]
	}
	result = strings.Join(wordArr, " ")
	return result
}
